<?php

class Jf_Auth {

    protected static $_instance = null;

    protected $_storage = null;

    protected function __construct () {}

    protected function __clone () {}

    public static function getInstance () {
        if (null === self::$_instance) {
            self::$_instance = new self ();
        }
        return self::$_instance;
    }

    public function getStorage ($storage = null) {
        if (isset ($storage)) {
            ;
            $this -> setStorage (new Zend_Auth_Storage_Session ($storage));
        }
        return $this -> _storage;
    }

    public function setStorage (Zend_Auth_Storage_Interface $storage) {
        $this -> _storage = $storage;
        return $this;
    }

    public function hasIdentity ($storage = null) {
        return  ! $this -> getStorage ($storage) -> isEmpty ();
    }

    public function clearIdentity ($storage = null) {
        $this -> getStorage ($storage) -> clear ();
    }

}
